#include "puzzle.h"
#include <iostream>

using namespace std;

bool puzzle::runEvent()
{
	cout << "Answer the question" << endl;
	cout << question << endl;
	string answer;
	cout << "Type your answer: ";
	cin >> answer;

	if(answer == this->answer)
		return true;
	else
	{
		cout << "Your answer is wrong!";
		cout << "Retype your answer: ";
		cin >> answer;
		if(answer == this->answer)
			return true;
		cout << "Sorry! your answer is still wrong! ";
		cout << "Your game have to be ended here!";
		return false;

	}
}

puzzle::puzzle(string question, string answer, bool isStar)
{
	this->life = 2;
	this->question = question;
	this->answer = answer;
	this->setIsStar(isStar);
	this->setVisited(false);
}
void puzzle::input(ifstream &fi)
{
	char temp[1000];
	string question = "";
	string answer = "";
	for(int i=0; i < 5; i++)
	{
		fi.getline(temp,1000);
		question = question + temp + "\n";
	}
	this->question = question;
	fi.getline(temp,1000);
	answer = temp;
	this->answer = answer;
}
puzzle::puzzle(void)
{
}